package com.tbfs.admin.web;

import java.util.List;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.Action;
import com.tbfs.admin.service.sdk.IRoleService;
import com.tbfs.admin.vo.Role;
import com.tbfs.common.BaseAction;

public class LoadRoleAction extends BaseAction {

	private static final Logger logger = Logger
			.getLogger(LoadRoleAction.class);

	// init service
	public IRoleService roleService;

	// 构造函数
	public LoadRoleAction(IRoleService roleService) {
		this.roleService = roleService;
	}

	public LoadRoleAction() {

	}

	private List rows = null;

	private Integer total;

	private Role role;

	private String message;

	private String volidateAccessDataAuth;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	
	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public List getRows() {
		return rows;
	}

	public void setRows(List rows) {
		this.rows = rows;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	/**
	 * load contractinfo json data
	 * 
	 * @return
	 */
	public String loadData() {
		try {
			
			//初始化查询对象
			if(role==null){
				role = new Role();
			}
			//分页
			this.processPaginationBean();
			volidateAccessDataAuth = this.volidateAccessDataAuth();
			//所有数据
			if("0".equals(volidateAccessDataAuth)){
				
			}
			
			rows  =  roleService.getRoleList(role);
			total = roleService.getRoleListCounts(role);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Action.SUCCESS;
	}
	
}
